
<template>
    <div class="scroll">
      <router-link to="/ls"><img class="img" :class="navBarFixed == true ? 'navBarWrap' :''" src="@/assets/img/左箭头@2x.png" alt=""></router-link>
        <div class="nav" :class="navBarFixed == true ? 'navBarWrap' :''">电影详情</div>       
    </div>
</template>
 
<script>
export default {
  data() {
    return {
        navBarFixed: false,
    };
  },
 
  components: {},
 
  mounted() {
    window.addEventListener("scroll", this.watchScroll);
  },
 
  methods: {
    back(){
      
    },
    watchScroll() {
      var scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      //  当滚动超过 90 时，实现吸顶效果
      if (scrollTop > 90) {
        this.navBarFixed = true;
      } else {
        this.navBarFixed = false;
      }
    }
  }
};
</script>
<style scoped>
.scroll{
    height:.71rem;
    
}
.nav{
  line-height: 0.73rem;
    height: 0.88rem;
    font-size: 0.34rem;
    margin-right: 0.37rem;
    padding-top:0.15rem;
    padding-bottom: 0.15rem;
    padding-right: 3.09rem;
    width:100%;
    box-sizing: border-box;
    background:white;
    text-align: right;
    
    border-bottom:solid rgba(238,238,238,1) 0.01rem ;
}
.navBarWrap {
    position:fixed;
    top:0;
    z-index:996;
  }
.img{
    float: left;
    width: 0.22rem;
    margin-top: 0.27rem;
    margin-left: 0.28rem;
    z-index:999 !important;
    
  }
</style>